home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 30
/
Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso
/
Aminet
/
util
/
libs
/
jpeglibrary50.lha
/
jpeglibrary
/
autodocs
/
jpeg.autodoc
Wrap
Text File
|
1999-01-30
|
21KB
|
659 lines
TABLE OF CONTENTS
jpeg.library/--background--
jpeg.library/--future--
jpeg.library/--history--
jpeg.library/--information--
jpeg.library/AllocBufferFromJPEGA
jpeg.library/AllocJPEGCompressA
jpeg.library/AllocJPEGDecompressA
jpeg.library/CompressJPEGA
jpeg.library/DecompressJPEGA
jpeg.library/FreeJPEGBuffer
jpeg.library/FreeJPEGCompress
jpeg.library/FreeJPEGDecompress
jpeg.library/GetJPEGInfoA
jpeg.library/--background-- jpeg.library/--background--
PURPOSE
To allow de/compression of images into/from the jpeg image format.
COPYRIGHT
The copyright in this library is owned by Paul Huxham.
This software is based in part on the work of the Independent JPEG Group.
The jpeg de/compression routines are copyright by the Independent
JPEG Group, written by Thomas G. Lane.
DISCLAIMER
jpeg.library and its associated files are supposed to enable jpeg images
to be de/compressed. Even though every effort has been made to make
jpeg.library as stable and functional as possible, I cannot rule out the
possibility that jpeg.library may have bugs that have side effects
(possibly harmful) on your system.
I hereby reject any liability or responsibility for these or any other
consequences from the use of jpeg.library whatsoever. This includes, but
is not limited to, damage to your equipment, to your data, personal
injuries, financial loss or any other kinds of side effects.
jpeg.library is provided as-is. This means I do not guarantee that
jpeg.library is fit for any specific purpose and I do not guarantee any
bug fixes, updates or help during error recovery.
DISTRIBUTION
jpeg.library should be distributed at no charge to the end user. It may
be included on Aminet CDs.
The author retains all rights to the enclosed software. Payment is not
required for the use of jpeg.library.
REQUIREMENTS
A minimum of Kickstart 2.0 and 68020 CPU is required to use jpeg.library.
COMPLIER
jpeg.library was written and compiled using CED V3.5 and SAS/C 6.55 on
an Amiga 4000/060. CyberGuard was used to detect/correct programming
errors.
BUGS
Should you find any bugs, please report them so that they can be fixed.
Likewise any suggestions for improvment of the library should be
forwarded so that they can be addressed.
THANKYOUS
Many thanks to
Dinh Thi Kim Tuyen
-Who makes the sky blue and the world turn. I love you, forevermore.
Steve Quartly
- For saying its possible and then helping me do it.
Stephan Rupprecht
- For includes/jpeg_lib.h for different compilers.
AUTHOR
You can contact the author via:
email: paulh@mafeking.scouts.org.au
www: http://mafeking.scouts.org.au/~paulh/
or
P.O. Box 875
Morley,
Perth,
Western Australia 6943
jpeg.library/--future-- jpeg.library/--future--
Support the writing and reading of JFIF APP0 markers, which stores jpeg
codec version numbers and horizontal and vertical pixel densities.
Support the writing and reading of Adobe markers.
jpeg.library/--history-- jpeg.library/--history--
V5.0
> Fixed 3 #define errors in the old AllocRGB functions in jpeg.h.
> The jpeg code is now based on jpegsrc.v6b.tar.gz obtained from the
Independent JPEG Groups web site "http://www.ijg.org/".
> Added JPEG_BlockSmoothing to allow switching cross block smoothing
during image decoding on and off (defaults to on).
> Added JPEG_Progressive to enable jpeg streams to be created in
progressive mode (defaults to off).
> The example source code save_file.c now has a progressive tag for
testing progressive saving (currently set to FALSE, enable to test).
> Updated the documentation.
V4.2
> Corrected some small documentation typos in jpeg.h.
> Fixed a bug where if the source jpeg stream was in CMYK format, the
wrong colourspace format was returned from GetJPEGInfo().
> Renamed AllocRGBBufferFromJPEG() to AllocBufferFromJPEG() and
FreeJPEGRGBBuffer() to FreeJPEGBuffer(). Old code will continue to
work because of some defines in jpeg.h.
V4.0
> Corrected some small typos in the documentation.
> Added DCTMethods for de/compression. These can offset speed versus
quality. Check jpeg.h for the methods and tag to use.
V3.2
> Fixed a bug where when decompressing using a render hook, the userdata
was not passed to the hook.
> Added a new pragmas file which contains pragmas for different
compilers, thanks to Stephan Rupprecht for his help.
V3.1
> Fixed a bug where when decompressing to memory using memory pools
resulted in a 4k memory loss until the freeing of the memory pool.
V3.0
> Fixed a bug where aborting de/compression returned DE/COMPFAILURE not
DE/COMPABORTED.
> Some documentation errors and omissions are now fixed.
> Added a render callback hook for use during image decompression.
> Added memory pool support for image compression into a memory
destination stream.
V2.1
> Fixed a bug when there is insufficient memory and the library
attempted to use temporary files (previously would fail to load the
image). Now it will ask for a JPEGTMP: assignment to store the
temporary files into.
> Previously the maximum memory to use was fixed at 1 meg. Now it is
10% less than the total amount of free memory. If there is still
insufficient memory, temporary files will be used.
> Implemented progress indicator callback hooks for compression and
decompression.
> Added some additional error codes such as not a jpeg file etc (see
jpeg.h)
> Updated the example code to show new features of the library. Fixed
some documentation problems in the example code.
V1.0
> Initial release.
jpeg.library/--information-- jpeg.library/--information--
Although the documentation is not extensive, the examples are fairly well
layed out and easy to follow. They all use different methods of
accessing jpeg.library. You can choose the one that suits your
application best.
It is EXTREMELY IMPORTANT to check the colour space of the jpeg image you
have decoded (or are about to decode). For example, in a JPCS_GRAYSCALE
only one third the amount of information is returned compared to an rgb
triplet buffer as the grayscale image data is normally one byte per
pixel. For JPCS_UNKNOWN, check the number of bytes per pixel to establish
if the data is grayscale or not. For JPCS_RGB, the image data will be
returned as an rgb triplet array.
jpeg.library/AllocBufferFromJPEGA jpeg.library/AllocBufferFromJPEGA
NAME
AllocBufferFromJPEGA -- Allocate a jpeg decompression buffer (V1)
AllocBufferFromJPEG -- Varargs stub (V1)
SYNOPSIS
buffer = AllocBufferFromJPEGA( jph, taglist )
a0 a1
void *AllocBufferFromJPEGA( struct JPEGDecHandle *jph,
struct TagItem *taglist )
buffer = AllocBufferFromJPEG( jph, tag1, ... )
void *AllocBufferFromJPEG( struct JPEGDecHandle *jph, ULONG tag1, ... )
FUNCTION
Allocates enough memory to hold the decompressed version of the jpeg in
memory. The colourspace can be obtained from GetJPEGInfo(). This
function does not allocate an RGB sized buffer, but allocates enough
memory to hold the decoded image.
INPUTS
taglist - pointer to an optional tag list specifying how to modify the
image data.
Modifiers (used, but not saved in the jpeg handle):
JPG_ScaleNum - Return values as though scaled with this value.
JPG_ScaleDenom - Return values as though scaled with this value.
RESULT
buffer - is NULL for any error, or a pointer to the memory allocated.
WARNING
BUGS
NOTES
If you obtained your image sizes from GetJPEGInfo() and used scale tags,
you SHOULD also pass those same tag values to this function to allocate
the buffer, otherwise the buffer allocated will be the original size of
the image.
Previously this function was named AllocRGBFromJPEGA(). There are defines
in jpeg.h to allow older code to be compiled. Please refrain from using
the older names in new code.
SEE ALSO
FreeJPEGBuffer()
jpeg.library/AllocJPEGCompressA jpeg.library/AllocJPEGCompressA
NAME
AllocJPEGCompressA -- Allocate a jpeg compression handle (V1)
AllocJPEGCompress -- Varargs stub (V1)
SYNOPSIS
err = AllocJPEGCompressA( jph, taglist )
a0 a1
err = AllocJPEGCompressA( struct JPEGComHandle **jph,
struct TagItem *taglist )
err = AllocJPEGCompress( jph, tag1, ... )
err = AllocJPEGCompress( struct JPEGComHandle **jph, ULONG tag1, ... )
FUNCTION
Allocates a new jpeg handle.
Available tags:
JPG_DestMemStream - A pointer to a UBYTE pointer to take the data
generated by the compressor (if specified, must
also specify the JPG_DestMemStreamSize tag).
See NOTE below about this allocated memory.
JPG_DestMemStreamSize - A pointer to a ULONG to take the size of the
compressed data (if specified, must also
specify the JPG_DestMemStream).
JPG_DestFile - A BPTR to an already open AmigaDOS file.
New tags requiring V3.0
JPG_MemoryPool - A pointer to a exec V39 memory pool to store
the compressed jpeg data into. (NOT freed on
exit.)
INPUTS
jph - pointer to a struct JPEGComHandle pointer.
taglist - pointer to a tag list specifying the destination for the
compressed data and data size.
RESULT
err - if non NULL contains an error code. (For a complete list of error
codes, see jpeg.h)
WARNING
BUGS
NOTES
You are responsible for freeing the memory allocated to you, by calling
FreeVec() on the pointer supplied to AllocJPEGCompress() (if it isnt a
NULL value).
BUT if you are using the new JPG_MemoryPool tag in object allocation,
call an appropriate pool or puddle free routine.
SEE ALSO
FreeJPEGCompressA(), CompressJPEGA()
jpeg.library/AllocJPEGDecompressA jpeg.library/AllocJPEGDecompressA
NAME
AllocJPEGDecompressA -- Allocate a jpeg decompression handle (V1)
AllocJPEGDecompress -- Varargs stub (V1)
SYNOPSIS
err = AllocJPEGDecompressA( jph, taglist )
a0 a1
err = AllocJPEGDecompressA( struct JPEGDecHandle **jph,
struct TagItem *taglist )
err = AllocJPEGDecompress( jph, tag1, ... )
err = AllocJPEGDecompress( struct JPEGDecHandle **jph, ULONG tag1, ... )
FUNCTION
Allocates a new jpeg handle.
Available tags:
JPG_SrcMemStream - The source image is a segment of memory starting
at this address.
JPG_SrcMemStreamSize - The length of the memory based segment, in bytes.
JPG_SrcFile - A BPTR to an already open AmigaDOS file.
INPUTS
jph - pointer to a struct JPEGDecHandle pointer.
taglist - pointer to a tag list specifying the jpeg stream source and
size.
RESULT
err - if non NULL contains an error code. (For a complete list of error
codes, see jpeg.h)
WARNING
BUGS
SEE ALSO
FreeJPEGDecompressA(), DecompressJPEGA()
jpeg.library/CompressJPEGA jpeg.library/CompressJPEGA
NAME
CompressJPEGA -- Compress a jpeg stream (V1)
CompressJPEG -- Varargs stub (V1)
SYNOPSIS
err = CompressJPEGA( jph, taglist )
a0 a1
err = CompressJPEGA( struct JPEGComHandle *jph,
struct TagItem *taglist )
err = CompressJPEG( jph, tag1, ... )
err = CompressJPEG( struct JPEGComHandle **jph, ULONG tag1, ... )
FUNCTION
Compresses a jpeg stream into the location specified by
AllocJPGCompress() using the supplied tags.
Available tags:
JPG_SrcRGBBuffer - An RGB triplet buffer containing the source
image.
JPG_CompressHook - Calls a user specified function (see jpeg.h)
JPG_CompressUserData - User data passed to the hook function.
JPG_Width - Width of the image (REQUIRED).
JPG_Height - Height of the image (REQUIRED).
JPG_Quality - Jpeg save quality (1-100), defaults to 85.
JPG_BytesPerPixel - The number of bytes per image pixel, defaults
to 3.
JPG_ColourSpace - The type of image data stored in the buffer,
defaults to JPCS_RGB (see jpeg.h for others).
JPG_Smoothing - Apply image smoothing while saving (0-100),
defaults to none (0).
New tags requiring V2.1
JPG_ProgressHook - Calls a user specified function (see jpeg.h).
DO NOT pass a hook structure pointer here. Put
a pointer to your function. (See examples).
Returning a non NULL value from the hook will
abort a load in progress.
JPG_ProgressUserData - User data passed to the hook function (void *).
New tags requiring V4.0
JPG_DCTMethod - The DCT processing method to use for encoding,
defaults to DCT_ISLOW (see jpeg.h for others).
New tags requiring V5.0
JPG_Progressive - If TRUE, the jpeg stream will be created in
progressive mode, defaults to FALSE.
INPUTS
jph - pointer to a struct JPEGComHandle.
taglist - pointer to a tag list.
RESULT
err - if non NULL contains an error code. (For a complete list of error
codes, see jpeg.h)
WARNING
BUGS
NOTES
You are responsible for freeing the memory allocated to you, by calling
FreeVec() on the pointer supplied to AllocJPEGCompress().
BUT if you are using the new JPG_MemoryPool tag in object allocation,
call an appropriate pool or puddle free routine.
e.g.
UBYTE *cstream;
ULONG cstreamsize;
err = AllocJPEGCompress( &jpc, JPG_DestMemStream, &cstream,
JPG_DestMemStreamSize, &cstreamsize, TAG_DONE );
err = CompressJPEG( jpc, JPG_SrcRGBBuffer, buffer,
JPG_Width, x, JPG_Height, y, TAG_DONE );
FreeJPEGCompress( jpc );
/* Use the buffer here */
if ( cstream != NULL ) FreeVec( cstream );
SEE ALSO
AllocJPEGCompressA(), FreeJPEGCompressA()
jpeg.library/DecompressJPEGA jpeg.library/DecompressJPEGA
NAME
DecompressJPEGA -- Decompress a jpeg stream (V1)
DecompressJPEG -- Varargs stub (V1)
SYNOPSIS
err = DecompressJPEGA( jph, taglist )
a0 a1
err = DecompressJPEGA( struct JPEGDecHandle *jph,
struct TagItem *taglist )
err = DecompressJPEG( jph, tag1, ... )
err = DecompressJPEG( struct JPEGDecHandle **jph, ULONG tag1, ... )
FUNCTION
Decompresses a jpeg stream as specified by AllocJPGDecompress() and
supplied tags.
Available tags:
JPG_DestRGBBuffer - The decompressed image data is stored as RGB
triplets starting at this address. You must
allocate enough memory to take the image. Use
AllocRGBFromJPEG() to allocate the required
memory space.
JPG_DecompressHook - Calls a user specified function (see jpeg.h).
DO NOT pass a hook structure pointer here. Put
a pointer to your function. (See examples)
JPG_DecompressUserData - User data passed to the hook function (void *).
JPG_ScaleNum - Scale decompressed data with this value.
JPG_ScaleDenom - Scale decompressed data with this value.
New tags requiring V2.1
JPG_ProgressHook - Calls a user specified function (see jpeg.h).
DO NOT pass a hook structure pointer here. Put
a pointer to your function. (See examples).
Returning a non NULL value from the hook will
abort a load in progress.
JPG_ProgressUserData - User data passed to the hook function (void *).
New tags requiring V3.0
JPG_RenderHook - Calls a user specified function (see jpeg.h).
DO NOT pass a hook structure pointer here. Put
a pointer to your function. (See examples).
Returning a non NULL value from the hook will
abort a load in progress.
JPG_RenderUserData - User data passed to the hook function (void *).
New tags requiring V4.0
JPG_DCTMethod - The DCT processing method to use for decoding,
defaults to DCT_ISLOW (see jpeg.h for others).
New tags requiring V5.0
JPG_BlockSmoothing - If TRUE, apply cross block smoothing during
image decoding, defaults to TRUE.
INPUTS
jph - pointer to a struct JPEGDecHandle.
taglist - pointer to a tag list.
RESULT
err - if non NULL contains an error code. (For a complete list of error
codes, see jpeg.h)
WARNING
The jpeg code has a limition on scaling where, num must always be 1 and
denom can be either: 1, 2, 4, or 8. Undefined results occur if this is
not adhered to.
BUGS
SEE ALSO
AllocJPEGDecompressA(), FreeJPEGDecompressA()
jpeg.library/FreeJPEGBuffer jpeg.library/FreeJPEGBuffer
NAME
FreeJPEGBuffer -- Free a jpeg decompression buffer (V1)
SYNOPSIS
FreeJPEGBuffer( buffer )
a0
void FreeJPEGBuffer( void *buffer )
FUNCTION
Frees a buffer allocated with AllocBufferFromJPEGA().
INPUTS
buffer - Pointer to the allocated buffer returned by
AllocBufferFromJPEG().
RESULT
WARNING
BUGS
NOTES
Previously this function was named AllocRGBFromJPEGA(). There are defines
in jpeg.h to allow older code to be compiled. Please refrain from using
the older names in new code.
SEE ALSO
AllocBufferFromJPEG()
jpeg.library/FreeJPEGCompress jpeg.library/FreeJPEGCompress
NAME
FreeJPEGCompress -- Free a jpeg compression handle (V1)
SYNOPSIS
err = FreeJPEGCompress( jph )
a0
err = FreeJPEGCompress( struct JPEGComHandle *jph )
FUNCTION
Frees a jpeg handle.
INPUTS
jph - pointer to a struct JPEGComHandle.
RESULT
err - if non NULL contains an error code. (For a complete list of error
codes, see jpeg.h)
WARNING
BUGS
NOTES
You are responsible for freeing the memory allocated to you by
CompressJPEG(), by calling FreeVec() on the pointer supplied to
AllocJPEGCompress().
BUT if you are using the new JPG_MemoryPool tag in object allocation,
call an appropriate pool or puddle free routine.
SEE ALSO
AllocJPEGCompressA(), CompressJPEGA()
jpeg.library/FreeJPEGDecompress jpeg.library/FreeJPEGDecompress
NAME
FreeJPEGDecompress -- Free a jpeg decompression handle (V1)
SYNOPSIS
err = FreeJPEGDecompress( jph )
a0
err = FreeJPEGDecompress( struct JPEGDecHandle *jph )
FUNCTION
Frees a jpeg handle.
INPUTS
jph - pointer to a struct JPEGDecHandle.
RESULT
err - if non NULL contains an error code. (For a complete list of error
codes, see jpeg.h)
WARNING
BUGS
SEE ALSO
AllocJPEGDecompressA(), DecompressJPEGA()
jpeg.library/GetJPEGInfoA jpeg.library/GetJPEGInfoA
NAME
GetJPEGInfoA -- Get information about a jpeg handle (V1)
GetJPEGInfo -- Varargs stub (V1)
SYNOPSIS
err = GetJPEGInfoA( jph, taglist )
a0 a1
err = GetJPEGInfoA( struct JPEGDecHandle *jph, struct TagItem *taglist )
err = GetJPEGInfo( jph, tag1, ... )
err = GetJPEGInfo( struct JPEGDecHandle *jph, ULONG tag1, ... )
FUNCTION
Retrieves information about the jpeg handle and returns the values in
variables passed in with the taglist.
Available tags:
JPG_Width - Returns the width of the decoded image (ULONG).
JPG_Height - Returns the height of the decoded image (ULONG).
JPG_BytesPerPixel - Returns the number of bytes for every pixel,
(usually 3 - JPCS_RGB) (ULONG).
JPG_RowSize - Returns the width in bytes of one pixel row (ULONG).
JPG_ColourSpace - Returns the type of colour space stored in the jpeg
image (see jpeg.h for result codes) (UBYTE)
Modifiers (used, but not saved in the jpeg handle):
JPG_ScaleNum - Return values as though scaled with this value.
JPG_ScaleDenom - Return values as though scaled with this value.
The jpeg code has a limition on scaling where, num must always be 1 and
denom can be either: 1, 2, 4, or 8.
Only JPEGDecHandles can have values read from them, JPEGComHandle passed
to this function returns a JPGERR_NONE and the taglist remains untouched.
INPUTS
jph - pointer to a struct JPEGDecHandle.
taglist - pointer to an optional tag list specifying what data items to
retrieve for this jpeg handle.
RESULT
err - if non NULL contains an error code. (For a complete list of error
codes, see jpeg.h)
WARNING
BUGS
EXAMPLE
err = GetJPEGInfo( jph, JPG_Width, &x, JPG_Height, &y, TAG_DONE );
SEE ALSO